import { http1 } from '@/utils/http'
import type { mylogin } from '@/types/my'
export const loginAPI = (user) => {
  console.log('可以吗')
  console.log('登录接口对接')

  // 登录请求
  return http<any>({
    method: 'POST',
    url: `/user/login?username=${user.username}&password=${user.password}`,
  })
}
// token请求
export const tokenAPI = () => {
  console.log('token对接')

  return http<any>({
    method: 'GET',
    url: '/user/profile',
  })
}
// 注册请求
export const registerAPI = (information) => {
  console.log('注册接口对接')

  return http<any>({
    method: 'POST',
    url: '/user/regist',
    data: {
      ...information,
    },
  })
}
export const loginAPI1 = (user) => {
  console.log('微信接口对接')

  console.log(user, '微信user是')
  // 登录请求
  return http<any>({
    method: 'GET',
    url: `/wx/user/login?appid=${user.appid}&appSecret=${user.appSecret}&code=${user.code}`,
  })
}
// 获取我的页面的数据
export const getMyDataAPI = (obj) => {
  return http1<any>({
    method: 'POST',
    url: '/api/getMyDataAPI',
    data: obj,
  })
}
// 获取帖子数据
export const getTopicListAPI = (obj) => {
  return http1<any>({
    method: 'POST',
    url: '/api/getTopicListAPI11111',
    data: obj,
  })
}
// 获取我的页面的vip剩余天数
export const getVipAPI = (obj) => {
  return http1<any>({
    method: 'POST',
    url: '/api/getVipAPI',
    data: obj,
  })
}

